<?php

class Events extends Illuminate\Database\Eloquent\Model {
    protected $table = "laskiga_Events";
    protected $primaryKey = "event_id";
   
    
    public static function get_name($id) {
        $event = Events::find($id);
        return $event->event_name;
    }
    public static function get_id($name) {
        $event = Events::where('event_name', '=', $name)->first();
        return $event->event_id;
    }
    public static function get_all() {
        $columns = array(
            'event_id',
            'event_day',
            'event_start_time',
            'event_end_time',
            'event_description',
            'event_details',
            'venue_id',
            'updated_at'
        );
        $events = Events::all($columns);
        return $events;
    }

    public static function get_days(){
        // this return the day names as keys
        // should be fixed to return an array of days instead
        // if so, fix the event.html.twig template
        $days = Events::all(array('event_day'))->groupBy('event_day');
        return $days;
    }
    public static function get_categories(){
        $categories = Events::all(array('event_category'))->groupBy('event_category');
        return $categories;
    }
}


